﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MultiClassDBA.ChannelBuilder
{
    public partial class DatabaseInfoForm : Form
    {
        public DatabaseInfoForm()
        {
            InitializeComponent();
        }

        public bool isComplete()
        {
            return (serverTextBox.Text != "" && databaseTextBox.Text != "" &&
                userTextBox.Text != "" && passwordTextBox.Text != "");
        }

        public string getHost()
        {
            return serverTextBox.Text;
        }

        public string getDatabase()
        {
            return databaseTextBox.Text;
        }

        public string getUsername()
        {
            return userTextBox.Text;
        }

        public string getPassword()
        {
            return passwordTextBox.Text;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            passwordTextBox.Text = "";//so that isComplete() returns false
            this.Close();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void cbxDBMS_SelectedIndexChanged(object sender, EventArgs e)
        {
            //if (cbxDBMS.SelectedItem.ToString() == ChannelBuilder.ChannelBuilderMainWindow.MSSQL_PROVIDER)
            //{
            //    serverTextBox.Text = "VuTran-PC";
            //    databaseTextBox.Text = "ChannelDB";
            //    userTextBox.Text = "sa";
            //    passwordTextBox.Text = "123";
            //}
            //else if (cbxDBMS.SelectedItem.ToString() == ChannelBuilder.ChannelBuilderMainWindow.MYSQL_PROVIDER)
            //{
            //    serverTextBox.Text = "localhost";
            //    databaseTextBox.Text = "channel_db";
            //    userTextBox.Text = "root";
            //    passwordTextBox.Text = "123456";
            //}
            //else if (cbxDBMS.SelectedItem.ToString() == ChannelBuilder.ChannelBuilderMainWindow.ACCE)
            //{
            //    databaseTextBox.Text = "F:\\DrLois\\GuaveProject\\ChannelBuilder\\ChannelDB.mdb";
            //}
        }

        public String GetProvider()
        {
            if (cbxDBMS.SelectedItem != null)
                return cbxDBMS.SelectedItem.ToString();
            return null;
        }

    }
}
